 
DEFINE BUFFER mrpdet FOR mrp_det.

FOR EACH mrp_det NO-LOCK 
    WHERE mrp_type BEGINS ''AND mrp_dataset BEGINS ''AND mrp_part BEGINS 'AA',
    EACH pt_mstr WHERE pt_part = mrp_part AND pt_pm_code BEGINS ''
    BREAK BY mrp_part BY mrp_due_date: 
    DISP 
        mrp_part    FORMAT "X(12)" WHEN FIRST-OF(mrp_part)
        mrp_nbr     FORMAT "X(12)" 
        mrp_type    FORMAT "X(8)" 
        mrp_dataset FORMAT "X(8)" 
        mrp_due_date 
        mrp_rel_date 
        mrp_qty 
        pt_pm_code
        mrp_detail 
        mrp_ord_site 
        mrp_line 
        mrp_line2 
        mrp_keyid 
        mrp_site 
        mrp__qad01 
        WITH WIDTH 150 .

    IF mrp_dataset = 'wo_mstr'THEN DO:
       FIND wo_mstr NO-LOCK WHERE wo_nbr = mrp_nbr NO-ERROR.
       IF AVAILABLE (wo_mstr) THEN DO :
          DOWN 1.
          DISP 
              wo_part     @ mrp_nbr
              wo_qty_ord  @ mrp_type
              wo_status   @ mrp_dataset
              .
       END.
    END.
END.


